import Mock from 'mockjs'

// get请求从config.url获取参数，post从config.body中获取参数
function param2Obj (url) {
  const search = url.split('?')[1]
  if (!search) {
    return {}
  }
  return JSON.parse(
    '{"' +
    decodeURIComponent(search)
      .replace(/"/g, '\\"')
      .replace(/&/g, '","')
      .replace(/=/g, '":"') +
    '"}'
  )
}

let List = [
    {
        "id": "edCf8Bc7-C259-a9BD-Fecc-BEb3bfBEDaEF",
        "name": "Helen",
        "authority": 1
    },
    {
        "id": "Fe1a90Ec-C1e4-b7Af-bb65-3bCF3B4fc76A",
        "name": "Daniel",
        "authority": 0
    },
    {
        "id": "15B5b76C-b8Ae-6BC1-B4ED-BBECb4E1A12D",
        "name": "Jeffrey",
        "authority": 0
    },
    {
        "id": "50bEfabD-7B2E-4cb5-fbE4-c7c7ebEEb033",
        "name": "Brian",
        "authority": 1
    },
    {
        "id": "d542E819-b707-9257-4461-5eFF468322bE",
        "name": "Sandra",
        "authority": 0
    },
    {
        "id": "fd36Dbe4-1f48-7DB6-BbE1-43b33EEC2fCd",
        "name": "Michelle",
        "authority": 1
    },
    {
        "id": "9D26b9cD-2AB3-61a8-DbE2-b529E0C0F7FD",
        "name": "Jeffrey",
        "authority": 1
    },
    {
        "id": "fCBDedb8-45Fd-a40D-Cdfd-8ffDAb11dFBd",
        "name": "Jason",
        "authority": 0
    },
    {
        "id": "6dFCF5EA-d693-d138-11d5-dda9b89Dfd9A",
        "name": "Eric",
        "authority": 0
    },
    {
        "id": "559aDfA4-cADA-6E71-3c1B-aFd75075c461",
        "name": "Angela",
        "authority": 0
    },
    {
        "id": "35216E09-C5DF-Bf1b-fDcB-EAEB5AfF3F10",
        "name": "Donna",
        "authority": 0
    },
    {
        "id": "A377B3aF-1F1b-19DE-d13c-E4FBFC735b1f",
        "name": "Patricia",
        "authority": 1
    },
    {
        "id": "7CfC4b7C-5356-ed96-AE25-1375f5e45AfA",
        "name": "Michael",
        "authority": 0
    },
    {
        "id": "a41BAFCD-bA70-9feD-c8df-CCeA844ccDc4",
        "name": "Robert",
        "authority": 0
    },
    {
        "id": "DEE4b577-e6Ce-1c76-36Ed-A21D1FCBAdd1",
        "name": "Maria",
        "authority": 0
    },
    {
        "id": "df6ce814-AeC8-7EFA-BCE1-beC47941CB8d",
        "name": "Shirley",
        "authority": 1
    },
    {
        "id": "cACd139C-c717-a5f7-6BeB-6E9becC36cf5",
        "name": "John",
        "authority": 1
    },
    {
        "id": "44de4dEf-4ad7-8aFd-AA6B-d9fcFf6B9cCc",
        "name": "Brenda",
        "authority": 1
    },
    {
        "id": "9cfd99FF-7Bee-b755-96B5-b3fE1e3b0ff0",
        "name": "Donna",
        "authority": 0
    },
    {
        "id": "8C23AA8e-1391-E9FE-855c-5eb4c9Aa7D44",
        "name": "Thomas",
        "authority": 0
    },
    {
        "id": "c152B7f3-df91-95d4-c1c5-85E6A7efEBD7",
        "name": "Maria",
        "authority": 1
    },
    {
        "id": "cf45CDdE-3Cfb-e0ed-1bC8-AFFcC268cdF3",
        "name": "George",
        "authority": 1
    },
    {
        "id": "E5Bd0388-2672-41C8-B1ab-eBEddE1E8c18",
        "name": "John",
        "authority": 1
    },
    {
        "id": "3b2dAE0a-ED13-11b0-46d5-Ec3Ca41C8F89",
        "name": "Jose",
        "authority": 0
    },
    {
        "id": "68d7Ff63-BDa5-9Eb2-FCB7-db346c91F884",
        "name": "Ronald",
        "authority": 0
    },
    {
        "id": "0aAa4d77-4A25-c4F7-3505-BAd8a9716EE1",
        "name": "Thomas",
        "authority": 1
    },
    {
        "id": "E17B4dA1-A67B-9D2D-e0Bd-D43ccFeCAcb1",
        "name": "Kenneth",
        "authority": 0
    },
    {
        "id": "ED71dCA2-decD-44f0-Ef3e-b596ECBE5b62",
        "name": "Sandra",
        "authority": 0
    },
    {
        "id": "862D3eBC-BFFE-1Eb5-e951-a5c13A052ecb",
        "name": "Edward",
        "authority": 1
    },
    {
        "id": "3bE3baB1-CBeB-627f-B5cf-bCaFAAebc59C",
        "name": "Scott",
        "authority": 1
    },
    {
        "id": "82473D92-b1ba-9CcF-b86A-dF8d2664DAcE",
        "name": "Melissa",
        "authority": 0
    },
    {
        "id": "fa6D4a28-BdDA-4e1C-3d9B-2e3cbF7Ace68",
        "name": "Christopher",
        "authority": 0
    },
    {
        "id": "9f42f848-B6B5-Ddbb-cB2C-88e9d6F15CAb",
        "name": "Barbara",
        "authority": 0
    },
    {
        "id": "d44B01C4-88bC-e920-d168-CdAa0FEfc1Ec",
        "name": "Mark",
        "authority": 1
    },
    {
        "id": "B8dDCbaE-52b4-6ecF-ADaf-b6f9CcACc327",
        "name": "Lisa",
        "authority": 0
    },
    {
        "id": "2E4D78BF-4e24-27C1-b5C6-d15d9cDa637B",
        "name": "Thomas",
        "authority": 0
    },
    {
        "id": "A5dBa2e2-956d-19Be-EF53-8DCB88B690b6",
        "name": "Ruth",
        "authority": 1
    },
    {
        "id": "1c3cDadc-84fF-eB63-7165-4D7ee47cAaDC",
        "name": "Carol",
        "authority": 1
    },
    {
        "id": "fD48e7e6-CCed-20Bd-6fb6-e93C11Fd64Ed",
        "name": "Edward",
        "authority": 1
    },
    {
        "id": "6eD94A4E-A2CC-ABdc-f0Bf-36ec11e2c371",
        "name": "Helen",
        "authority": 1
    },
    {
        "id": "1fD0FF5b-cC0c-719b-eb90-8ADABb8d5BB2",
        "name": "Jeffrey",
        "authority": 0
    },
    {
        "id": "585b6E67-cFdC-31FB-B4dd-EC8cfdB1B15c",
        "name": "Jeffrey",
        "authority": 0
    },
    {
        "id": "efb29E63-f6EF-10f5-cEEB-eE96A7C4BdCe",
        "name": "Eric",
        "authority": 0
    },
    {
        "id": "Ae0d6ece-EAe3-65AF-4Ce3-79E3fDFDeE9D",
        "name": "Angela",
        "authority": 0
    },
    {
        "id": "14BB86F0-16Bf-4f32-d12F-dBB3e0d6f211",
        "name": "Timothy",
        "authority": 1
    },
    {
        "id": "48413fa8-43fD-8ff4-A3df-4F9eECCA4e78",
        "name": "Thomas",
        "authority": 1
    },
    {
        "id": "6CdCcCCD-E3DF-bB3e-F3aa-456086c9f1Fb",
        "name": "Jason",
        "authority": 0
    },
    {
        "id": "Ff9cc8Cc-5796-C615-5DFb-EDE5bEFDbAEc",
        "name": "Margaret",
        "authority": 1
    },
    {
        "id": "f13CEbCF-A2Cf-8de9-65ee-050ea7d846Eb",
        "name": "Dorothy",
        "authority": 1
    },
    {
        "id": "B98e711C-b5Cc-bE1B-834d-6bE86978dC0c",
        "name": "George",
        "authority": 1
    },
    {
        "id": "f3d7EcAd-F51d-faBe-1b9c-bAC3E8a7DEe3",
        "name": "Linda",
        "authority": 1
    },
    {
        "id": "aDe8beda-c3EA-a5E7-ff2e-525231aF4b6f",
        "name": "Timothy",
        "authority": 0
    },
    {
        "id": "4C1abdBf-c6E1-6ffB-8838-2B188977E9f7",
        "name": "Shirley",
        "authority": 1
    },
    {
        "id": "B5ED8434-c67C-B4AB-5bD3-83BcfDA4473c",
        "name": "Maria",
        "authority": 0
    },
    {
        "id": "Fcf6f8Fd-d71C-3CE7-fD9B-96B3e07Aeb4C",
        "name": "Dorothy",
        "authority": 1
    },
    {
        "id": "F2cc82E4-6eA0-e1Ab-C2DD-23ff3E662BdD",
        "name": "Kimberly",
        "authority": 1
    },
    {
        "id": "CAdCE79E-bD5F-86dD-EEC4-6FC9986F926F",
        "name": "Gary",
        "authority": 1
    },
    {
        "id": "00Fb8EfA-7c9F-fF6B-E1Dc-068D9fbeeAf8",
        "name": "Michael",
        "authority": 1
    },
    {
        "id": "dA675E19-a0bC-DF88-6c88-2cd1dEA5fdec",
        "name": "Jose",
        "authority": 1
    },
    {
        "id": "76FaDb4c-3531-0eeA-31e2-c87cacF7Cae0",
        "name": "John",
        "authority": 0
    },
    {
        "id": "806ac45B-Ce5c-e5EC-d64b-6499E15D753c",
        "name": "Susan",
        "authority": 1
    },
    {
        "id": "eA01EA94-6DC6-9759-2ec5-f7f7FcCc4cB7",
        "name": "Eric",
        "authority": 0
    },
    {
        "id": "FD6E4A2e-eF88-bCf4-A5D4-3edbEECE3Dc6",
        "name": "Robert",
        "authority": 1
    },
    {
        "id": "A2abD6A5-b18e-FB9C-1DF1-eA4C2F6ef0bB",
        "name": "Steven",
        "authority": 1
    },
    {
        "id": "Ad67CA3B-f4b2-c47B-182f-AFa1f84DFaFb",
        "name": "Dorothy",
        "authority": 1
    },
    {
        "id": "bCc25Ad7-bB17-BC1e-1Cda-9D54B59cB3eA",
        "name": "Kevin",
        "authority": 1
    },
    {
        "id": "15aB8F9d-7CC9-9cD8-eFeA-b9dcBD6e33Fd",
        "name": "Jose",
        "authority": 1
    },
    {
        "id": "0dcb1b5f-A5f3-2AD9-dcEF-fA56D1EDf11E",
        "name": "John",
        "authority": 0
    },
    {
        "id": "8AF48dc6-DB6c-8cE8-5cFc-c6Ddd8fE5dB9",
        "name": "Karen",
        "authority": 1
    },
    {
        "id": "AC7bECc1-CEaC-25dB-2Dff-81101CddcFbA",
        "name": "Timothy",
        "authority": 0
    },
    {
        "id": "cf5CDFc5-afb5-6CDd-2b46-Cb2F973fa8Ce",
        "name": "Richard",
        "authority": 1
    },
    {
        "id": "84E6Cab1-c9e1-8AF2-2Cb6-de7dCBE3BfBD",
        "name": "Anna",
        "authority": 1
    },
    {
        "id": "0364DAa2-Df3B-32f4-8Bd4-fCCa804AF66c",
        "name": "Shirley",
        "authority": 0
    },
    {
        "id": "eCeBBC46-C8F9-eF16-949C-Abc6861E6842",
        "name": "Jessica",
        "authority": 0
    },
    {
        "id": "d8F8Dbd3-BD2a-42fF-E5FC-8dcb4326DcB3",
        "name": "Ronald",
        "authority": 1
    },
    {
        "id": "DA4B563C-43db-8342-cbc0-a728BCB2BBd1",
        "name": "Kenneth",
        "authority": 1
    },
    {
        "id": "4564cAD4-c789-e016-DaCf-E8e91ED62e21",
        "name": "Maria",
        "authority": 0
    },
    {
        "id": "2Cf753C4-ef33-52fA-69EB-9D85e704f9EB",
        "name": "Christopher",
        "authority": 0
    },
    {
        "id": "3Bf84ead-FAeB-dAb2-cBAd-9935E95Fef0B",
        "name": "Sandra",
        "authority": 0
    },
    {
        "id": "cdCC2610-565a-6FCb-b96e-a6A1acbAb240",
        "name": "Maria",
        "authority": 1
    },
    {
        "id": "18A58c6c-b2d3-ae0d-f6fb-078EC650C863",
        "name": "Angela",
        "authority": 1
    },
    {
        "id": "cEFA2Fce-b73F-E7C7-76e1-CA2f4F1a89AF",
        "name": "Michelle",
        "authority": 1
    },
    {
        "id": "4bBAd63B-FCB8-EbcC-7178-e773ffDd6De8",
        "name": "Elizabeth",
        "authority": 0
    },
    {
        "id": "ce13B3a5-1f6c-cfdd-F16c-1daf694c422A",
        "name": "Steven",
        "authority": 0
    },
    {
        "id": "09D9da5F-d9eb-997a-7b5C-fDf539a5Bcf0",
        "name": "Matthew",
        "authority": 0
    },
    {
        "id": "eD888E52-D6D8-D4aB-e61E-C1273B64CAEE",
        "name": "Matthew",
        "authority": 0
    },
    {
        "id": "0dD9Bf7A-C5D6-Ac1F-2797-49BDfd227DdE",
        "name": "Robert",
        "authority": 0
    },
    {
        "id": "c213681a-3dff-C43a-Ef7f-6d6C9ccC6bA7",
        "name": "Susan",
        "authority": 0
    },
    {
        "id": "e77c581E-B1eD-4CeF-fF8d-741A8807fbc6",
        "name": "Michael",
        "authority": 1
    },
    {
        "id": "Dd84c287-16bB-F565-f87D-b55CCACc8D6c",
        "name": "Joseph",
        "authority": 1
    },
    {
        "id": "EE152FeE-bC72-C16C-A72b-Cc6FcCfA1a71",
        "name": "Kevin",
        "authority": 0
    },
    {
        "id": "C08DFbD8-bBCC-7eBe-2d92-Efb8B9AFee7A",
        "name": "Kevin",
        "authority": 1
    },
    {
        "id": "Ef728Fe3-c4CE-29E2-fB8D-85d1Fb64bD6b",
        "name": "Thomas",
        "authority": 1
    },
    {
        "id": "285f7b88-B1Dd-ff1f-EAeD-15fDe86C7904",
        "name": "Mark",
        "authority": 1
    },
    {
        "id": "EF7bC887-8c4d-9d5B-0128-3C9cc289133d",
        "name": "Matthew",
        "authority": 1
    },
    {
        "id": "55A251dD-4ae3-A3c2-63E7-6F9e6B5BA095",
        "name": "Jennifer",
        "authority": 1
    },
    {
        "id": "dDAabA9F-caFF-Ab89-26E3-7DeAf2CB0b69",
        "name": "Sandra",
        "authority": 1
    },
    {
        "id": "fE01bbe1-B79A-B3CA-6ADB-66fd5D1BcbC2",
        "name": "Jessica",
        "authority": 1
    },
    {
        "id": "9cceA561-A0bA-aDce-cFDE-Bc9b7AcB59CC",
        "name": "Paul",
        "authority": 0
    },
    {
        "id": "B9228957-99D0-e4b2-EA74-33E9fe0e256e",
        "name": "Laura",
        "authority": 0
    },
    {
        "id": "C7c10AcC-292d-ed53-B42A-0c6Aa621ea7d",
        "name": "Karen",
        "authority": 1
    },
    {
        "id": "2B2a39eC-4A2d-78eC-Bb91-BdDb09AD9B84",
        "name": "Brenda",
        "authority": 0
    },
    {
        "id": "dbB06cc7-C905-ffb2-Fb23-9E6d3eA6cfF0",
        "name": "Ruth",
        "authority": 1
    },
    {
        "id": "BAeE58B8-6352-8b66-e6fc-4FcbC7FE8dCA",
        "name": "Elizabeth",
        "authority": 1
    },
    {
        "id": "9d30899A-6b5E-873a-c02e-3C9832dC25D7",
        "name": "Jose",
        "authority": 1
    },
    {
        "id": "cE36dFfB-485d-dAbB-E6d1-cb567D26eEcb",
        "name": "Christopher",
        "authority": 1
    },
    {
        "id": "08D87fBF-Ef84-efF8-10be-6957CD08B9AD",
        "name": "Margaret",
        "authority": 0
    },
    {
        "id": "53bC6eA4-E1FB-74dB-cb9f-ac27Dde95e19",
        "name": "Charles",
        "authority": 0
    },
    {
        "id": "cFFdAb8F-BA1A-dD8D-B533-5D44B32181d5",
        "name": "Sarah",
        "authority": 0
    },
    {
        "id": "3defce9b-4edB-9efC-8c59-3ABcef29B5ce",
        "name": "Timothy",
        "authority": 0
    },
    {
        "id": "acACC0aF-f05f-fFDd-6bB5-8eAABCD63ABe",
        "name": "Kenneth",
        "authority": 0
    },
    {
        "id": "8CeCD80B-7508-c46e-fD8C-A87f324be1d6",
        "name": "Elizabeth",
        "authority": 1
    },
    {
        "id": "740dee60-A8A3-dD8B-5B51-BeAfe3C0eD4F",
        "name": "Scott",
        "authority": 1
    },
    {
        "id": "9A407dC3-1D76-13E4-dac9-d4eD86568a1f",
        "name": "Sharon",
        "authority": 1
    },
    {
        "id": "Bd389BC5-478B-A9ef-2893-85Bba7F3De5F",
        "name": "Sharon",
        "authority": 1
    },
    {
        "id": "45FbD949-6Ae3-e8EA-CcAe-DA6fc3c07Bb1",
        "name": "Matthew",
        "authority": 0
    },
    {
        "id": "3DEA5279-9E7E-Afb6-267E-D9953b62466E",
        "name": "Anthony",
        "authority": 1
    },
    {
        "id": "B079bEEe-B0Ff-ccab-bbDA-cc2A564CB5Eb",
        "name": "Michelle",
        "authority": 1
    },
    {
        "id": "cC86B51e-bB83-b13B-2142-eb051fa23C6E",
        "name": "Deborah",
        "authority": 0
    },
    {
        "id": "0E34e86E-afEc-ff3B-51e3-77ae60C8C7d6",
        "name": "Timothy",
        "authority": 0
    },
    {
        "id": "AdC3Af22-BEe5-74e7-8dc4-CAef9f3cafCA",
        "name": "Nancy",
        "authority": 1
    },
    {
        "id": "0De9fFeb-b662-805C-4364-Ef4Ce074fbDd",
        "name": "Linda",
        "authority": 0
    },
    {
        "id": "c6C256F4-5b61-f9E2-DcEB-EBcbEAcA9FD6",
        "name": "Brenda",
        "authority": 0
    },
    {
        "id": "46e329cF-24BD-624b-dDc3-9A8EAB83eBd9",
        "name": "David",
        "authority": 1
    },
    {
        "id": "FECfFb2D-DB7D-cffd-3C4d-b7DB7dFDfF2E",
        "name": "Sandra",
        "authority": 1
    },
    {
        "id": "dF8e6f58-99c6-C31d-33f7-CB6FADCbD6Ff",
        "name": "Jose",
        "authority": 1
    },
    {
        "id": "bDcAfBD5-ACc4-BecC-AB1d-82AEEc1627Cc",
        "name": "Betty",
        "authority": 0
    },
    {
        "id": "F69723Ed-463A-F271-CD4C-F4928735DB59",
        "name": "Karen",
        "authority": 1
    },
    {
        "id": "86db361B-b458-EC98-FDEe-ed563C1Ab3Bf",
        "name": "John",
        "authority": 1
    },
    {
        "id": "c4AE9c4B-7F9C-6F91-f9B5-5dEb2f4BACBc",
        "name": "Frank",
        "authority": 1
    },
    {
        "id": "5CCC0Dc3-A0Ef-f3E7-7d3f-fD0B239D57Cb",
        "name": "Jeffrey",
        "authority": 0
    },
    {
        "id": "57f71c1f-0E89-DCEA-8ff4-4893fdCbd152",
        "name": "Eric",
        "authority": 0
    },
    {
        "id": "EE66c7FA-7214-3178-4853-EB39133Ec4ba",
        "name": "Steven",
        "authority": 0
    },
    {
        "id": "f5D8d1Ad-D4dA-161E-3845-D6F3dbc7FcCe",
        "name": "Kenneth",
        "authority": 0
    },
    {
        "id": "22A7678C-f02F-D67E-b6fC-7258396Fe1cB",
        "name": "Barbara",
        "authority": 0
    },
    {
        "id": "Aee4Bd69-Ed4B-d09B-2BB4-fC18d83ECc3F",
        "name": "Kevin",
        "authority": 1
    },
    {
        "id": "1Bbfb775-2d65-990F-B2Fe-2fFE1E5bC5C5",
        "name": "Mary",
        "authority": 0
    },
    {
        "id": "5C29baEc-E3cf-CDdc-ab91-A47b1C85E6CE",
        "name": "Laura",
        "authority": 0
    },
    {
        "id": "4fa97DB5-CEFb-B924-fACc-8DF113Eba2B9",
        "name": "Donna",
        "authority": 0
    },
    {
        "id": "BAED5FB9-c2b1-bF79-8ea3-49E7C37Bc32E",
        "name": "Brenda",
        "authority": 0
    },
    {
        "id": "Dccf3c4E-14dc-52Cb-fDbc-b29Cff1A4ebC",
        "name": "Sandra",
        "authority": 0
    },
    {
        "id": "DE38C8D2-EfbD-C402-BDe1-69C87b8db64F",
        "name": "Margaret",
        "authority": 0
    },
    {
        "id": "cA9AecF6-ce8b-Feb7-AB4a-4392cf1BE89d",
        "name": "Daniel",
        "authority": 0
    },
    {
        "id": "DdeA4Cab-B894-2aA9-dB23-FecedD79a27A",
        "name": "Betty",
        "authority": 1
    },
    {
        "id": "8c3f3E31-f9F7-F78A-aC16-ED57Bb6fffdD",
        "name": "Robert",
        "authority": 0
    },
    {
        "id": "EFDc5CF1-13A4-32B5-e7b1-76317017EA59",
        "name": "Linda",
        "authority": 0
    },
    {
        "id": "6eEcCb03-D98E-5b42-58f7-Ccf9eF6CDEdA",
        "name": "Michelle",
        "authority": 1
    },
    {
        "id": "8Fb9EbAF-Ceb7-16A7-1eB6-5FbE46244cF1",
        "name": "Ronald",
        "authority": 0
    },
    {
        "id": "dD8bCBFb-Be6B-C2BE-5e3F-A19c35Ddb71F",
        "name": "Patricia",
        "authority": 1
    },
    {
        "id": "11EEA1fd-79C3-DD55-5592-1826eAC3BC4C",
        "name": "Gary",
        "authority": 0
    },
    {
        "id": "6179D0d3-D17f-A76f-eCAC-D63355f7A8b2",
        "name": "Donald",
        "authority": 1
    },
    {
        "id": "3C9dAC92-2CBB-E959-dF9c-97E3CBCBfBdf",
        "name": "Donna",
        "authority": 1
    },
    {
        "id": "A2beEb76-CDcA-37d7-dd27-Bba963ab2Deb",
        "name": "Sharon",
        "authority": 1
    },
    {
        "id": "1fBE5A6e-BAdc-A4ff-CAc3-F3CDbb29eDc2",
        "name": "Jason",
        "authority": 1
    },
    {
        "id": "6FEc4B9C-C0de-bC92-ebEc-bC65550e1Bdc",
        "name": "Laura",
        "authority": 0
    },
    {
        "id": "BefEEB68-C6dA-0C6E-CC5d-Cd3348879bbE",
        "name": "Kimberly",
        "authority": 0
    },
    {
        "id": "fD5dfEAe-fA95-28DE-B28C-B39C4bc1cE64",
        "name": "Dorothy",
        "authority": 0
    },
    {
        "id": "4ebD88CF-AD43-2d48-E845-b76c355d1D99",
        "name": "Angela",
        "authority": 1
    },
    {
        "id": "cB561Aa9-3A5c-bD8F-d1c1-7DC37d11fc3A",
        "name": "Elizabeth",
        "authority": 1
    },
    {
        "id": "10B1dAF4-bc7E-9FFd-Cec8-D1E6e8D6Cbcc",
        "name": "Gary",
        "authority": 1
    },
    {
        "id": "dCC2C36c-DAB1-EFe5-EEd5-41Fae3C1A5A2",
        "name": "Jeffrey",
        "authority": 1
    },
    {
        "id": "DfbB2389-6bAc-4fcF-C631-dCE8aCfDD4Ea",
        "name": "Laura",
        "authority": 0
    },
    {
        "id": "c72BE3ff-Ad82-E84f-C617-4d7BdeAD9FFE",
        "name": "Edward",
        "authority": 1
    },
    {
        "id": "988BE1C0-Db25-df3F-9aEC-ECCB34bBe313",
        "name": "Paul",
        "authority": 1
    },
    {
        "id": "52668fd2-EbBD-f32b-04fD-b2DB15F7E453",
        "name": "John",
        "authority": 0
    },
    {
        "id": "380ed3A8-4871-87cd-7Fc5-635DCAdc54cc",
        "name": "Michael",
        "authority": 1
    },
    {
        "id": "BdB96ffC-d07e-CB58-b25C-b2C58cDEd3aF",
        "name": "Deborah",
        "authority": 0
    },
    {
        "id": "6D9835D3-143F-5387-bBa1-8C6a0ac7fdf7",
        "name": "Nancy",
        "authority": 0
    },
    {
        "id": "352Dc39E-b57D-eA2c-192D-AAFd0e3DAAA6",
        "name": "Mary",
        "authority": 0
    },
    {
        "id": "FE392EE3-C96d-Be3f-cCD9-8FAACeEFcAbF",
        "name": "Steven",
        "authority": 0
    },
    {
        "id": "c6bfAcFf-DB58-0BcD-B3B6-fCBED8c56AFf",
        "name": "Jessica",
        "authority": 1
    },
    {
        "id": "f0D19EE8-47bA-06F6-c5af-68fAf67CfDc9",
        "name": "James",
        "authority": 0
    },
    {
        "id": "84C57e8C-759D-6301-7fcf-fccc719A78be",
        "name": "Kenneth",
        "authority": 0
    },
    {
        "id": "7d23D8fB-BCFb-f8db-1Fed-5f0Bf1c8ECE5",
        "name": "Kevin",
        "authority": 1
    },
    {
        "id": "B05fdEC9-Fe74-f40D-9894-F143E8D3EdA0",
        "name": "Daniel",
        "authority": 1
    },
    {
        "id": "4b29C9bC-EAd6-e272-3dd3-53d4EdBB9CA4",
        "name": "Angela",
        "authority": 1
    },
    {
        "id": "cfD0d3df-1F7f-11bd-cF97-2Ed7AF2fceb4",
        "name": "Karen",
        "authority": 1
    },
    {
        "id": "9fDFDC4E-6eea-8E7a-DdD9-44bfdBC40c61",
        "name": "Sandra",
        "authority": 1
    },
    {
        "id": "d63967b9-13d9-AccE-3272-6eaDc1DDE1F4",
        "name": "Steven",
        "authority": 1
    },
    {
        "id": "515DaAFd-C36c-426E-Cc9c-1d77c0FD1897",
        "name": "Robert",
        "authority": 0
    },
    {
        "id": "4C46bE45-8c33-6F51-ACA0-Fc3Dede11dAe",
        "name": "Mary",
        "authority": 1
    },
    {
        "id": "2eFbCcAa-4e1B-E89B-Bce5-89Ac8924d7Ff",
        "name": "Scott",
        "authority": 1
    },
    {
        "id": "6d8EFEF2-9dEE-DEf6-7f3C-FDD6DCEAfB6f",
        "name": "Sarah",
        "authority": 1
    },
    {
        "id": "235122ED-f575-14EE-eBBF-bEdb381E94c4",
        "name": "Richard",
        "authority": 1
    },
    {
        "id": "E749fD88-a6AD-7c3D-cf38-B0d61ca4CBfC",
        "name": "Timothy",
        "authority": 1
    },
    {
        "id": "9d5AD9B7-4E34-D60A-49B8-685D7934BDA1",
        "name": "Gary",
        "authority": 1
    },
    {
        "id": "dDFbAd9C-cCE0-A033-9FCD-CbC65671C42C",
        "name": "Deborah",
        "authority": 0
    },
    {
        "id": "bCFcB2Ac-aB8B-dfE6-C97A-E5844cA38296",
        "name": "Jessica",
        "authority": 1
    },
    {
        "id": "4Ae61aAE-4fe9-2DEe-f1F5-AFfe9E98b4DF",
        "name": "Richard",
        "authority": 1
    },
    {
        "id": "e44A419A-3ec2-A2f4-deaa-14a84FCaeCC6",
        "name": "Sharon",
        "authority": 0
    },
    {
        "id": "20A47f6C-cbBb-fC3C-8239-F1ff96d6920f",
        "name": "Donald",
        "authority": 1
    },
    {
        "id": "CAc77992-3E5E-D66d-D63b-CA34E253bAe5",
        "name": "Frank",
        "authority": 1
    },
    {
        "id": "BbAF7D3e-49E5-6219-1Ea1-eE95e741C0E9",
        "name": "Brian",
        "authority": 0
    },
    {
        "id": "E6AEcf8d-ddd9-E99E-738e-feA21Ae8e9AA",
        "name": "Brenda",
        "authority": 0
    },
    {
        "id": "58ADC0BB-dEbE-D26C-E3D4-9BDDE8FA941E",
        "name": "Brenda",
        "authority": 0
    },
    {
        "id": "B6Db5bdE-0714-bbA9-eFDB-BdCB4E678EF0",
        "name": "Brenda",
        "authority": 1
    },
    {
        "id": "73b54C4b-Af37-FfEc-352a-2eBAe6cefBaE",
        "name": "Donald",
        "authority": 1
    },
    {
        "id": "e5e2386B-AC4C-F3Dd-8932-d2b7ECd2b695",
        "name": "Matthew",
        "authority": 0
    },
    {
        "id": "2f0DAdEE-0CF9-3f88-B7B7-58E927cfff36",
        "name": "Robert",
        "authority": 0
    },
    {
        "id": "4f9B6d87-eEdD-E4ab-9eaC-f28dDc9bbCe4",
        "name": "Brenda",
        "authority": 1
    }
]


const count = 200

// for (let i = 0; i < count; i++) {
//   List.push(
//     Mock.mock({
//         id: Mock.Random.guid(),
//         name: Mock.Random.cname(),
//         authority: Mock.Random.integer(0, 1)
//     })
//   )
// }





export default {
  /**
   * 获取列表
   * 要带参数 name, page, limt; name可以不填, page,limit有默认值。
   * @param name, page, limit
   * @return {{code: number, count: number, data: *[]}}
   */
  getUserList: config => {
    const { name, page = 1, limit = 20 } = param2Obj(config.url)
    console.log('name:' + name, 'page:' + page, '分页大小limit:' + limit)
    // 获取搜索结果
    const mockList = List.filter(user => {
      if (name && user.name.indexOf(name) === -1) return false
      return true
    })
    const pageList = mockList.filter((item, index) => index < limit * page && index >= limit * (page - 1))
    console.log(pageList)

    return {
      code: 20000,
      count: mockList.length,
      list: pageList
    }
  },
  /**
   * 增加用户
   * @param name, addr, age, birth, sex
   * @return {{code: number, data: {message: string}}}
   */
  createUser: config => {
    const { name, authority } = JSON.parse(config.body)
    // console.log(JSON.parse(config.body))
    List.unshift({
      id: Mock.Random.guid(),
      name: name,
      authority: authority
    })
    return {
      code: 20000,
      data: {
        message: '添加成功'
      }
    }
  },
  /**
   * 删除用户
   * @param id
   * @return {*}
   */
  deleteUser: config => {
    const { id } = param2Obj(config.url)
    if (!id) {
      return {
        code: -999,
        message: '参数不正确'
      }
    } else {
      List = List.filter(u => u.id !== id)
      return {
        code: 20000,
        message: '删除成功'
      }
    }
  },
  /**
   * 批量删除
   * @param config
   * @return {{code: number, data: {message: string}}}
   */
  batchremove: config => {
    let { ids } = param2Obj(config.url)
    ids = ids.split(',')
    List = List.filter(u => !ids.includes(u.id))
    return {
      code: 20000,
      data: {
        message: '批量删除成功'
      }
    }
  },
  /**
   * 修改用户
   * @param id, name, addr, age, birth, sex
   * @return {{code: number, data: {message: string}}}
   */
  updateUser: config => {
    const { id, name, authority } = JSON.parse(config.body)
    const authority_num = parseInt(authority)
    List.some(u => {
      if (u.id === id) {
        u.name = name
        u.authority = authority_num
        return true
      }
    })
    return {
      code: 20000,
      data: {
        message: '编辑成功'
      }
    }
  }
}
